import { ProfileType } from '@/store/reducers/user';
import request from '@/utils/request';

/**
 * 获取用户自己信息
 * @returns
 */
export const getUserInfoAPI = () => {
  return request({
    url: '/v1_0/user',
    method: 'get',
  });
};

/**
 * 获取用户个人资料
 * @returns
 */
export const getUserProfileAPI = () => {
  return request({
    url: '/v1_0/user/profile',
    method: 'get',
  });
};

/**
 * 编辑个人资料头像
 * @returns
 */
export const updatePhotoAPI = (data: FormData) => {
  return request({
    url: '/v1_0/user/photo',
    method: 'patch',
    data,
  });
};

/**
 * 编辑用户个人资料
 * @returns
 */
export const updateProfileAPI = (data: Partial<ProfileType>) => {
  return request({
    url: '/v1_0/user/profile',
    method: 'patch',
    data,
  });
};
